from fastapi import APIRouter

from app.database.postgre import SessionDep
from app.models.common import AppIdJSON
from app.models.recharge_logs import AppRechargeLogListParams
from app.services import accounts, recharge_logs

router = APIRouter(
    prefix='/api/v1/recharge_logs',
    tags=['backend', 'recharge_logs']
)


@router.get('/list')
async def recharge_logs_list(
        account: accounts.LoggedInAccount,
        query_params: AppRechargeLogListParams,
        session: SessionDep):
    response = await recharge_logs.get_recharge_logs_list(account, query_params, session)
    return response


@router.post('/clear')
async def clear_all_recharge_logs(
        account: accounts.LoggedInAccount,
        json_data: AppIdJSON,
        session: SessionDep):
    response = await recharge_logs.clear_all_recharge_logs(account, json_data, session)
    return response
